com.supermap.ar.areffect
Class AREffectElement
- java.lang.Object
-
- com.supermap.ar.areffect.AREffectElement
-
- Direct Known Subclasses:
- ARGltfElement, ARMapElement, ARParticleElement, ARVideoElement, ARVideoElement2, ARViewElement
public class AREffectElement extends java.lang.ObjectAR special object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static interfaceAREffectElement.onRenderableLoadCompleteListenerResource load listenerstatic interfaceAREffectElement.OnTapListenerThe click listener interfacestatic interfaceAREffectElement.OnTouchListenerThe touch listener interfacestatic classAREffectElement.PositionTypeThe displaying position types
-
Constructor Summary
Constructors Constructor and Description AREffectElement(android.content.Context context)Construction method
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanaddChild(AREffectElement obj)Adds sub objectsvoidaddChilds(java.util.ArrayList<AREffectElement> list)Sets the sub object arrayvoidaddOnTapListener(AREffectElement.OnTapListener listener)Adds a click listenervoidaddOnTouchListener(AREffectElement.OnTouchListener listener)Sets the touch listenervoidclearAllChilds()Clears all sub objectsvoiddestroy()Destruction of objectsjava.util.ArrayList<AREffectElement>getAllChilds()Gets the sub object arrayAREffectElementgetChild(int index)Searches sub objects according to serial numberAREffectElementgetChild(long id)Gets sub objects according to their idjava.util.ArrayList<AREffectElement>getChild(java.lang.String Name)Gets the sub objectsintgetChildCount()Gets the number of sub objectsElementTypegetElementType()Get the element typelonggetId()Gets idfloat[]getLocalScaleFactor()Gets the scale of the object in the AR worldAREffectElement.onRenderableLoadCompleteListenergetOnRenderableLoadCompleteListener()Gets the listening event that the resource has completed loadingPoint3DgetPosition()Gets the position of AR object on the AR sceneAREffectElement.PositionTypegetPositionType()Gets the display type of positionPoint3DgetRelativePosition()Gets the position of AR object relative to its parent nodefloatgetRotationAngle()Returns the rotation angleVectorgetRotationAxis()Returns rotating vectorfloat[]getScaleFactor()Gets the ratio of object in ar worldLocationgetWGSCoordinates()Gets geographical position of modelbooleanisShadowCaster()Determines whether the element can cast shadows in the scenebooleanisShadowReceiver()Determines whether this element can accept shadows from other elements in the scenebooleanisTransformable()booleanisVisible()Gets whether it is visiblevoidremoveChild(AREffectElement element)Removes child node elementsvoidremoveChild(int index)Deletes sub objectsvoidremoveChild(long id)Deletes sub objectsvoidremoveChild(java.lang.String Name)Deletes sub objectsvoidremoveOnTapListener()Removes the click listenervoidremoveOnTouchListener()Removes the touch listenervoidsetElementName(java.lang.String objectName)Gets object's namevoidsetLocalScaleFactor(float[] scales)Sets the scale of objects in the AR worldvoidsetOnRenderableLoadCompleteListener(AREffectElement.onRenderableLoadCompleteListener onRenderableLoadCompleteListener)Set the listening event for the completion of resource loading Support elements:ARViewElementARVideoElementARVideoElement2ARGltfElementARWebViewElementOften used to listen for loading of Android View and Gltf modelsvoidsetParentNode(EffectElement arEffectElement)Relative layout.voidsetParentNode(EffectView arEffectView)Absolute layout.AREffectElementsetParentNode(EffectView arEffectView, Node parent)Binds elements to other nodes in the viewvoidsetPosition(Point3D position)Sets the position of AR object on the AR scenevoidsetRelativePosition(Point3D position)Sets the position of AR object relative to its parent nodevoidsetRelativePosition(Vector3 position)Sets the position of the AR object relative to the parent node * @param positionvoidsetRotateAlwaysToCamera(boolean alwaysToCamera)Sets whether the attitude of the element is always relative to the camera positionvoidsetRotateToCameraType(Node.RotateToCameraType type)Set the position of the node relative to the camera : Horizontal, Vertical, Horizontal_VerticalvoidsetRotationAngle(Vector vector, float rotationAngle)Sets the rotation anglevoidsetScaleFactor(float[] scales)Sets the ratio of object in ar worldvoidsetShadowCaster(boolean flag)Sets whether shadows can be cast in the scenevoidsetShadowReceiver(boolean flag)Sets whether shadows from other objects can be accepted in the scenevoidsetTransformable(boolean isTransformable)Sets the model status (whether users can zoom and rotate models with gestures)voidsetVisiblity(boolean visiblity)Sets whether it is visible.voidsetWGSCoordinates(Location elementLocation)Sets model position using geographical coordinates
-
-
-
Constructor Detail
-
AREffectElement
public AREffectElement(android.content.Context context)
Construction method- Parameters:
context- The context.
-
-
Method Detail
-
getId
public long getId()
Gets id- Returns:
-
setElementName
public void setElementName(java.lang.String objectName)
Gets object's name- Parameters:
objectName-
-
addChild
public boolean addChild(AREffectElement obj)
Adds sub objects- Parameters:
obj- sub objects- Returns:
- whether the adding is successful.
-
getChild
public AREffectElement getChild(int index)
Searches sub objects according to serial number- Parameters:
index- the sequence number- Returns:
- Sub object.
-
removeChild
public void removeChild(int index)
Deletes sub objects- Parameters:
index-
-
removeChild
public void removeChild(long id)
Deletes sub objects- Parameters:
id-
-
removeChild
public void removeChild(java.lang.String Name)
Deletes sub objects- Parameters:
name-
-
clearAllChilds
public void clearAllChilds()
Clears all sub objects
-
getAllChilds
public java.util.ArrayList<AREffectElement> getAllChilds()
Gets the sub object array- Returns:
-
addChilds
public void addChilds(java.util.ArrayList<AREffectElement> list)
Sets the sub object array- Parameters:
list-
-
getChildCount
public int getChildCount()
Gets the number of sub objects- Returns:
-
getChild
public java.util.ArrayList<AREffectElement> getChild(java.lang.String Name)
Gets the sub objects- Parameters:
name-- Returns:
-
getChild
public AREffectElement getChild(long id)
Gets sub objects according to their id- Parameters:
id-- Returns:
-
getPosition
public Point3D getPosition()
Gets the position of AR object on the AR scene- Returns:
-
setPosition
public void setPosition(Point3D position)
Sets the position of AR object on the AR scene- Parameters:
position-
-
getWGSCoordinates
public Location getWGSCoordinates()
Gets geographical position of model- Returns:
-
setWGSCoordinates
public void setWGSCoordinates(Location elementLocation)
Sets model position using geographical coordinates- Parameters:
elementLocation-
-
getRelativePosition
public Point3D getRelativePosition()
Gets the position of AR object relative to its parent node- Returns:
-
setRelativePosition
public void setRelativePosition(Point3D position)
Sets the position of AR object relative to its parent node- Parameters:
position-
-
getRotationAxis
public Vector getRotationAxis()
Returns rotating vector- Returns:
-
getRotationAngle
public float getRotationAngle()
Returns the rotation angle- Returns:
-
setRotationAngle
public void setRotationAngle(Vector vector, float rotationAngle)
Sets the rotation angle- Parameters:
vector- the rotation axis. you can use unit vector directlyrotationAngle- the rotation angle
-
getScaleFactor
public float[] getScaleFactor()
Gets the ratio of object in ar world- Returns:
-
setScaleFactor
public void setScaleFactor(float[] scales)
Sets the ratio of object in ar world- Parameters:
scales- including 3 values that are coefficients of x, y, and z
-
getPositionType
public AREffectElement.PositionType getPositionType()
Gets the display type of position- Returns:
-
setParentNode
public void setParentNode(EffectView arEffectView)
Absolute layout. Sets parent nodes- Parameters:
arEffectView-
-
setParentNode
public void setParentNode(EffectElement arEffectElement)
Relative layout. Sets parent nodes- Parameters:
arEffectElement-
-
setVisiblity
public void setVisiblity(boolean visiblity)
Sets whether it is visible. The visibility of each sub object changes over the changes of parent objects- Parameters:
visiblity-
-
isVisible
public boolean isVisible()
Gets whether it is visible- Returns:
-
isTransformable
public boolean isTransformable()
-
setTransformable
public void setTransformable(boolean isTransformable)
Sets the model status (whether users can zoom and rotate models with gestures)- Parameters:
isTransformable-
-
addOnTapListener
public void addOnTapListener(AREffectElement.OnTapListener listener)
Adds a click listener- Parameters:
listener-
-
removeOnTapListener
public void removeOnTapListener()
Removes the click listener
-
addOnTouchListener
public void addOnTouchListener(AREffectElement.OnTouchListener listener)
Sets the touch listener- Parameters:
listener-
-
removeOnTouchListener
public void removeOnTouchListener()
Removes the touch listener
-
getElementType
public ElementType getElementType()
Get the element type- Returns:
-
removeChild
public void removeChild(AREffectElement element)
Removes child node elements- Parameters:
element-
-
setLocalScaleFactor
public void setLocalScaleFactor(float[] scales)
Sets the scale of objects in the AR world
-
getLocalScaleFactor
public float[] getLocalScaleFactor()
Gets the scale of the object in the AR world- Returns:
-
setRelativePosition
public void setRelativePosition(Vector3 position)
Sets the position of the AR object relative to the parent node * @param position
-
setShadowCaster
public void setShadowCaster(boolean flag)
Sets whether shadows can be cast in the scene- Parameters:
flag-
-
setShadowReceiver
public void setShadowReceiver(boolean flag)
Sets whether shadows from other objects can be accepted in the scene- Parameters:
flag-
-
isShadowCaster
public boolean isShadowCaster()
Determines whether the element can cast shadows in the scene- Returns:
-
isShadowReceiver
public boolean isShadowReceiver()
Determines whether this element can accept shadows from other elements in the scene- Returns:
-
destroy
public void destroy()
Destruction of objects
-
setRotateAlwaysToCamera
public void setRotateAlwaysToCamera(boolean alwaysToCamera)
Sets whether the attitude of the element is always relative to the camera position- Parameters:
alwaysToCamera-
-
setRotateToCameraType
public void setRotateToCameraType(Node.RotateToCameraType type)
Set the position of the node relative to the camera: Horizontal, Vertical, Horizontal_Vertical- Parameters:
type-
-
getOnRenderableLoadCompleteListener
public AREffectElement.onRenderableLoadCompleteListener getOnRenderableLoadCompleteListener()
Gets the listening event that the resource has completed loading- Returns:
-
setOnRenderableLoadCompleteListener
public void setOnRenderableLoadCompleteListener(AREffectElement.onRenderableLoadCompleteListener onRenderableLoadCompleteListener)
Set the listening event for the completion of resource loadingSupport elements:ARViewElementARVideoElementARVideoElement2ARGltfElementARWebViewElementOften used to listen for loading of Android View and Gltf models- Parameters:
onRenderableLoadCompleteListener-
-
setParentNode
public AREffectElement setParentNode(EffectView arEffectView, Node parent)
Binds elements to other nodes in the view- Parameters:
arEffect- View View parameter.parent-NodeUse this method to bind elements directly to nodes IfEffectViewis not null,hen the binding relation:AREffectElement->parentNode->EffectView- Returns:
-
-